package com.example;

public class Book {
    /* 定义类的属性 */
    /* 首字母小写，以后的每个单词首字母大写 */
    private String bookName;
    private String author;
    private double price;
    private int count;
    private String version;

    /* 空参方法本身就有，但是如果显式的写出了带参数构造方法，这个就会丢失，需要也写出来 */
    public Book() {

    }

    /*构造方法*/
    public Book(String bookName,
                String author,
                double price,
                int count,
                String version) {
        this.bookName = bookName;
        this.author = author;
        this.price = price;
        this.count = count;
        this.version = version;
    }

    /* 属性的操作方法 */
    /* 首字母小写，后续每个单词首字母大写 */
    public void setBookName(String bookName) {
        /* 把参数赋值给该类对象的属性 */
        this.bookName = bookName;
    }

    public String getBookName() {
        /* 返回该类对象的属性值 */
        return bookName;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    @Override
    public String toString() {
        return "Book{" +
                "bookName='" + bookName + '\'' +
                ", author='" + author + '\'' +
                ", price=" + price +
                ", count=" + count +
                ", version='" + version + '\'' +
                '}';
    }
}
